<template>
  <div class="container" @click="handleCommonGallary">
    <div class="wrapper">
       <swiper :options="swiperOption">
        <swiper-slide v-for="(item, index) of imgs" :key="index"><img class="gallary-img" :src="item" alt=""> </swiper-slide>
        <div class="swiper-pagination" slot="pagination"></div>
      </swiper>
    </div>
  </div>
</template>
<script>
export default {
  name: 'CommonGallary',
  props: {
    imgs: {
      type: Array,
      default () {
        return []
      }
    }
  },
  methods: {
    handleCommonGallary () {
      this.$emit('closeGallary')
    }
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observer: true,
        observeParents: true
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.container{
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #000;
  z-index: 3;
  .wrapper{
    // overflow: hidden;
    height: 0;
    padding-bottom: 70%;
    width: 100%;
    .swiper-container{
      overflow: inherit;
    }
    .gallary-img{
      width: 100%;
    }
    .swiper-pagination{
      bottom: -1rem;
      color: #fff;
    }
  }
}
</style>
